package com.yuchen.ishop.service;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import com.yuchen.core.jdbc.DBContextHolder;

@Component
@Aspect
public class DynamicDataSourceAspect {

	@Pointcut("execution (* com.yuchen.ishop.service.user..*.*(..))")  
    public void setDS2(){}
	
	@Before("setDS2()") 
    public void setDynamicDataSource(JoinPoint jp) {  		
		System.out.println("----do aspect----");
    	DBContextHolder.setDBType(DBContextHolder.DATA_SOURCE2);  
    	
    }
}
